<?php
include_once($_SERVER['DOCUMENT_ROOT'] ."/include/user/inc.php");
include_once($_SERVER['DOCUMENT_ROOT'] ."/include/tucao/inc.php");
include_once($_SERVER['DOCUMENT_ROOT'] ."/include/mblog/inc.php");
include_once($_SERVER['DOCUMENT_ROOT'] ."/include/qq/inc.php");



//所有的参数
$g_cgival 	= array();
//存储中间数据 非输出数据 可以不用
$g_pro	 	= array();
//要显示的数据 输出数据
$g_show 	= array();

function check_cgi_pro()
{		
	global $g_cgival, $g_pro, $g_show, $config;
	
	cgi::both($g_cgival["p"], "p", "");
	$g_cgival["p"] = intval($g_cgival["p"]);
	
	if($g_cgival["p"] < 1) $g_cgival["p"]=1;
	
	cgi::both($g_cgival["topic_id"], "topic_id", "");
	$g_cgival["topic_id"] = intval($g_cgival["topic_id"]);
	
	cgi::both($g_cgival["show_type"], "show_type", "");
	$g_cgival["show_type"] = intval($g_cgival["show_type"]);
	
	cgi::both($g_cgival["uid"], "uid", "");
	$g_cgival["uid"] = intval($g_cgival["uid"]);
	
	cgi::both($g_cgival["order"], "order", "time");
}


function get_data()
{
	global $g_cgival, $g_pro, $g_show, $config;
	$g_show["hide_shadow"] = true;
	$g_show["uid"] = $uid = $g_cgival["uid"] ;
	$g_show["user_top_type"] = "my_mblog";
	$g_show["pcount"] = $g_cgival["pcount"] = 20;
	$g_show["p"] = $g_cgival["p"];
	
	$g_show["topic_id"] = $topic_id = $config["current_site_id"];
	//登录相关
	$user_info = new user_info();
	$is_login = $user_info->is_logined();
	if($is_login)
	{
		$user_detail_info = $user_info->get_cur_user_info();
		$g_show["is_logined"] = true;
		$g_show["current_user_info"] = $user_detail_info;
	}
	
	//登录相关
	
	
	
	$g_show["user_info"] = $user_info->get_user_info_by_uid($uid);
	
	$g_show["user_info"]["head_url"] = str_replace("/50","/180",$g_show["user_info"]["head_url"]);
	
	$g_show["page_title"] =$page_title;
	$g_show["pubu_uid"] = $uid;

	$g_show["show_type"] = $g_cgival["show_type"];
	$g_show["topic_id"] = $g_cgival["topic_id"];
	$g_show["topic_show_type"] = $config["topic_show_type"];

	$current_site_name = $config["current_site_name"];
	$g_show["page_title"] = "{$g_show["user_info"]["user_nickname"]}的{$current_site_name}分享_游戏美图" ;
	$g_show["page_keywords"] = "{$g_show["user_info"]["user_nickname"]}的{$current_site_name}分享_游戏美图" ;
	$g_show["page_desc"] = "{$g_show["user_info"]["user_nickname"]}的 {$current_site_name}分享_游戏美图" ;
	$g_show["show_mblog_tag"] = 1;

	
	
	$mod_mblog = new mod_mblog();
	$list = $mod_mblog->get_pic_pubu_info($g_cgival["p"],$g_cgival["pcount"],$type="common",$topic_id,$g_cgival["show_type"],$uid,$order);
	
	$g_show["list"] = $list["list"];
	$g_show["count"] = $list["count"];
	
	$Pages = new Pages($g_show["count"],$g_cgival["p"],$g_cgival["pcount"]);
	//$g_show["page_bar"] = $Pages->getLinks("?uid={$g_cgival["uid"]}&show_type={$g_cgival["show_type"]}&topic_id={$g_cgival["topic_id"]}&p=",100);

	//瀑布分别在几行
	$g_show["col_num"] = 4;
}



try {
	$g_show['error'] = 0;
	$g_show['errmsg'] = "";
	check_cgi_pro();
	get_data();
	
} catch (Exception $e) {
	$g_show['error'] = 1;
	$g_show['errmsg'] = $e->getMessage();
}

show_pro();


exit;

function show_pro()
{
	global $g_cgival, $g_pro, $g_show, $config;

	$smarty = p_get_smarty();	
	$smarty->assign("g_show", $g_show);
	if (isset($_GET["debug"]))
	{
		print_r($g_show);
	}
	$smarty->display("user/huaban_user_mblog.html");
	
	unset($g_cgival);
	unset($g_pro);
	unset($g_show);
	unset($config);
	
}

